<?php
namespace app\api\controller;

use think\Controller;
header("Access-Control-Allow-Origin: *"); // 允许任意域名发起的跨域请求  
header('Access-Control-Allow-Headers: X-Requested-With,X_Requested_With,token,model,uid,platform,Content-Type,edition');
class Index extends Controller
{
    private $action=array(
        'edition',
        'system',
        'send_sms',
        'register',
        'login_pwd',
        'login_verifi',
        'login_wx',
        'register_wx',
        'repassword',
        'user_info',
        'user_integral',
        'banner',
        'index_type',
        'work_address',
        'system_address',
        'my_address',
        'search',
        'hot_search',
        'recommend',
        'car_operation',
        'del_car_goods',
        'del_car',
        'collect',
        'del_collect',
        'collect_type',
        'my_collect',
        'daily_type',
        'daily_goods',
        'type_list',
        'all_type',
        'add_address',
        'readdress',
        'default_address',
        'del_address',
        'my_car',
        'coupon',
        'exchange_coupon',
        'my_coupon',
        'rush_list',
        'rush_goods',
        'special_goods',
        'goods_label',
        'type_goods',
        'upload',
        'head_img',
        'integral_log',
        'car_number',
        'goods_details',
        'useful_time',
        'useful_coupon',
        'demand',
        'demand_list',
        'demand_details',
        'problem_list',
        'problem_details',
        'article_details',
        'store_type',
        'identity',
        'order',
        'order_time',
        'order_pay',
        'order_count',
        'order_list',
        'order_details',
        'order_continue_pay',
        'order_cancel',
        'order_collect',
        'order_return',
        'order_status',
        'message_count',
        'message_list',
        'message_details',
        'message_read',
    );
    //可使用方法
    private $action_details=array(
        'edition'=>array('name'=>'检测版本','check_user'=>0),
        'system'=>array('name'=>'系统设置','check_user'=>0),
        'send_sms'=>array('name'=>'发送短信','check_user'=>0),
        'register'=>array('name'=>'注册','check_user'=>0),
        'login_pwd'=>array('name'=>'密码登录','check_user'=>0),
        'login_verifi'=>array('name'=>'短信登录','check_user'=>0),
        'login_wx'=>array('name'=>'微信登录','check_user'=>0),
        'register_wx'=>array('name'=>'微信认证','check_user'=>0),
        'repassword'=>array('name'=>'修改密码','check_user'=>0),
        'user_info'=>array('name'=>'用户详情','check_user'=>1),
        'user_integral'=>array('name'=>'用户剩余积分','check_user'=>1),
        'banner'=>array('name'=>'banner','check_user'=>0),
        'index_type'=>array('name'=>'首页分类','check_user'=>0),
        'work_address'=>array('name'=>'服务地区','check_user'=>0),
        'system_address'=>array('name'=>'自提地址','check_user'=>0),
        'my_address'=>array('name'=>'我的收货地址','check_user'=>1),
        'search'=>array('name'=>'搜索商品','check_user'=>0),
        'hot_search'=>array('name'=>'热门搜索','check_user'=>0),
        'recommend'=>array('name'=>'首页推荐商品','check_user'=>0),
        'car_operation'=>array('name'=>'购物车操作','check_user'=>1),
        'del_car_goods'=>array('name'=>'删除购物车商品','check_user'=>1),
        'del_car'=>array('name'=>'清空购物车','check_user'=>1),
        'collect'=>array('name'=>'收藏','check_user'=>1),
        'del_collect'=>array('name'=>'取消收藏','check_user'=>1),
        'collect_type'=>array('name'=>'收藏商品的分类','check_user'=>1),
        'my_collect'=>array('name'=>'收的收藏商品','check_user'=>1),
        'daily_type'=>array('name'=>'常购商品分类','check_user'=>1),
        'daily_goods'=>array('name'=>'常购商品','check_user'=>1),
        'type_list'=>array('name'=>'商品分类','check_user'=>0),
        'all_type'=>array('name'=>'全部分类','check_user'=>0),
        'add_address'=>array('name'=>'添加收货地址','check_user'=>1),
        'readdress'=>array('name'=>'修改收货地址','check_user'=>1),
        'default_address'=>array('name'=>'默认收货地址','check_user'=>1),
        'del_address'=>array('name'=>'删除收货地址','check_user'=>1),
        'my_car'=>array('name'=>'我的购物车','check_user'=>1),
        'coupon'=>array('name'=>'优惠券(可积分兑换)列表','check_user'=>0),
        'exchange_coupon'=>array('name'=>'兑换优惠券','check_user'=>1),
        'my_coupon'=>array('name'=>'我的优惠券','check_user'=>1),
        'rush_list'=>array('name'=>'限时抢购计划','check_user'=>0),
        'rush_goods'=>array('name'=>'限时抢购计划商品','check_user'=>0),
        'special_goods'=>array('name'=>'特价商品','check_user'=>0),
        'goods_label'=>array('name'=>'商品标签列表','check_user'=>0),
        'type_goods'=>array('name'=>'分类商品','check_user'=>0),
        'upload'=>array('name'=>'上传图片','check_user'=>1),
        'head_img'=>array('name'=>'修改头像','check_user'=>1),
        'integral_log'=>array('name'=>'积分记录','check_user'=>1),
        'car_number'=>array('name'=>'购物车数量','check_user'=>1),
        'goods_details'=>array('name'=>'商品详情','check_user'=>0),
        'useful_time'=>array('name'=>'配送/自提时间','check_user'=>0),
        'useful_coupon'=>array('name'=>'可用优惠券','check_user'=>1),
        'demand'=>array('name'=>'提交需求','check_user'=>1),
        'demand_list'=>array('name'=>'需求列表','check_user'=>1),
        'demand_details'=>array('name'=>'需求详情','check_user'=>1),
        'problem_list'=>array('name'=>'常见问题','check_user'=>0),
        'problem_details'=>array('name'=>'常见问题详情','check_user'=>0),
        'article_details'=>array('name'=>'协议、文章详情','check_user'=>0),
        'store_type'=>array('name'=>'商铺类型','check_user'=>0),
        'identity'=>array('name'=>'申请认证','check_user'=>1),
        'order'=>array('name'=>'下单','check_user'=>1),
        'order_time'=>array('name'=>'剩余时间','check_user'=>1),
        'order_pay'=>array('name'=>'订单支付','check_user'=>1),
        'order_count'=>array('name'=>'订单数量','check_user'=>1),
        'order_list'=>array('name'=>'订单列表','check_user'=>1),
        'order_details'=>array('name'=>'订单详情','check_user'=>1),
        'order_continue_pay'=>array('name'=>'订单继续支付','check_user'=>1),
        'order_cancel'=>array('name'=>'取消订单','check_user'=>1),
        'order_collect'=>array('name'=>'订单收货','check_user'=>1),
        'order_return'=>array('name'=>'申请退货','check_user'=>1),
        'order_status'=>array('name'=>'订单状态','check_user'=>1),
        'message_count'=>array('name'=>'未消息数量','check_user'=>0),
        'message_list'=>array('name'=>'消息列表','check_user'=>0),
        'message_details'=>array('name'=>'消息列表详情','check_user'=>0),
        'message_read'=>array('name'=>'消息批量阅读','check_user'=>0),
    );
    //可使用方法信息

    /**
     * 接口的唯一入口
     */
    public function index()
    {
        if ($this->request->isPost()) {
            $edition = request()->header('edition');       //版本号 1.0
            $phone_model = request()->header('phoneModel');       //手机型号：IOS、Android
            $token = request()->header('token');       //用户token
            $uid = request()->header('uid');       //用户id
            $detailModel=request()->header('detailModel');       //手机具体型号
            $phoneSize=request()->header('phoneSize');       //手机尺寸
            $equipment=request()->header('equipment');       //手机设备号
            $method = $this->request->get('method');            //调用方法名
//            $sign = $this->request->param('sign');              //签名字符串
//            $data=$this->request->param('data');        //传输的数据（json格式）
//            $data=json_encode($data,true);  //转化为数组
            $data = $this->request->post();
            if (is_null($data)) {
                $data = array();
            }
            $action=$this->action;
            $action_details=$this->action_details;
            //检测用户是否登录操作
            if (isset($method) && $method) {
                if (!in_array($method,$action) || !isset($action_details[$method])) {
                    return $this->return_data(0,'访问链接出错');
                } else {
                    //以下记录请求信息
                    $data1=array();
                    foreach($data as $k=>$v){
                        $data1[$k]=urlencode($v);
                    }
                    $post=array('uid'=>$uid,
                        'token'=>$token,
                        'edition'=>$phone_model,
                        'method'=>$method,
                        'method_name'=>$action_details[$method]['name'],
                        'equipment'=>'型号：'.$detailModel.',屏幕尺寸：'.$phoneSize.',设备号：'.$equipment,
                        'post'=>urldecode(json_encode($data1)),
                        'create_time'=>time(),
                    );
                    $id=db('api_log')->insertGetId($post);
                    //以上记录请求信息
                    if($action_details[$method]['check_user']==1){
                        //即方法是操作购物车
                        if($token=='' || $uid<=0){
                            return $this->return_data(-1,'请先登录');
                        }
                        $user=$this->get_user($token,$uid);
                        if(empty($user)){
                            return $this->return_data(-1,'信息错误，请重新登录');
                        }
                        if($user['u_over_time']<=time()){
                            return $this->return_data(-1,'登录已过期，请重新登录');
                        }
                        if($user['u_status']!=1){
                            return $this->return_data(-1,'登录已过期，请重新登录');
                            //实际为用户被冻结了
                        }
                    }else{
                        //不需要进行用户认证的接口
                        $user=array();
                    }
                    $header=array('edition'=>$edition,'phone_model'=>$phone_model,'token'=>$token,'uid'=>$uid);
                    return $this->$method($header,$data,$user);
                }
            } else {
                return $this->return_data(0,'请传入调用方法名');
            }
        } else {
            return $this->return_data(0,'非法访问');
        }
    }
    /**
     * 接口的唯一入口(原来的，2019-08-22，废弃)

    public function index()
    {
    if ($this->request->isPost()) {
    $edition = request()->header('edition');       //版本号 1.0
    $phone_model = request()->header('phoneModel');       //手机型号：IOS、Android
    $token = request()->header('token');       //用户token
    $uid = request()->header('uid');       //用户id
    $method = $this->request->get('method');            //调用方法名
    //            $sign = $this->request->param('sign');              //签名字符串
    //            $data=$this->request->param('data');        //传输的数据（json格式）
    //            $data=json_encode($data,true);  //转化为数组
    $data=$this->request->post();
    if(is_null($data)){
    $data=array();
    }
    //
    $check_user=array(
    'user_info',//用户信息
    'user_integral',//用户剩余积分
    'my_address',//我的购物车
    'my_search',//我的搜索
    'del_search',//删除搜索
    'car_operation',//购物车操作
    'del_car_goods',//删除购物车商品
    'del_car',//清空购物车
    'collect',//收藏
    'del_collect',//取消收藏
    'collect_type',//我的收藏分类
    'my_collect',//我的收藏
    'daily_type',//常购商品分类
    'daily_goods',//常购商品
    'add_address',//添加收货地址
    'readdress',//修改收货地址
    'default_address',//默认收货地址
    'del_address',//删除收货地址
    'my_car',//我的购物车
    'exchange_coupon',//兑换优惠券
    'my_coupon',//我的优惠券
    'upload_information',//上传图片的信息
    'upload',//上传图片
    'head_img',//修改头像
    'integral_log',//积分记录
    'car_number',//购物车数量
    'useful_coupon',//我的优惠券
    'demand',//提交需求
    'demand_list',//需求列表
    'demand_details',//需求详情
    'identity',//申请是否认证
    'order',//下订单
    'order_time',//订单剩余时间
    'order_pay',//订单支付
    'order_count',//订单列表
    'order_list',//订单列表
    'order_details',//订单详情
    'order_cancel',//取消订单
    'order_continue_pay',//继续支付
    'order_collect',//收货
    'order_return',//申请退货
    'order_status',//订单状态
    );
    //检测用户是否登录操作
    if (isset($method) && $method) {
    if (!method_exists($this, $method)) {
    return $this->return_data(0,'链接出错');
    } else {
    if(in_array($method,$check_user)){
    //即方法是操作购物车
    if($token=='' || $uid<=0){
    return $this->return_data(-1,'请先登录');
    }
    $user=$this->get_user($token,$uid);
    if(empty($user)){
    return $this->return_data(-1,'信息错误，请重新登录');
    }
    if($user['u_over_time']<=time()){
    return $this->return_data(-1,'登录已过期，请重新登录');
    }
    if($user['u_status']!=1){
    return $this->return_data(-1,'登录已过期，请重新登录');
    //实际为用户被冻结了
    }
    }else{
    //不需要进行用户认证的接口
    $user=array();
    }
    $header=array('edition'=>$edition,'phone_model'=>$phone_model,'token'=>$token,'uid'=>$uid);
    return $this->$method($header,$data,$user);
    }
    } else {
    return $this->return_data(0,'请传入调用方法名');
    }
    } else {
    return $this->return_data(0,'非法访问');
    }
    }*/
    /**
     * 获取用户信息
     */
    function get_user($token,$uid){
        $user=db('user')
            ->where(array('u_id'=>$uid,'u_token'=>$token))
            ->find();
        return $user;
    }
    /**
     * 获取用户信息
     */
    function return_data($code,$msg,$data=array()){
        return json_encode(
            array(
                'code' => $code,
                'msg' => $msg,
                'data' => $data
            ),
            JSON_UNESCAPED_UNICODE
        );
    }
    /**
     * 检测版本
     */
    function edition($header,$data,$user){
        $res = new Edition();
        $return=$res->check_edition($header,$data,$user);
        return $this->return_data($return['code'],$return['msg'],$return['data']);
    }
    /**
     * 系统设置
     */
    function system($header,$data,$user){
        $res = new System();
        $return=$res->system($header,$data,$user);
        return $this->return_data($return['code'],$return['msg'],$return['data']);
    }
    /**
     * 发送短信
     */
    function send_sms($header,$data,$user){
        $res = new Sms();
        $return=$res->send_sms($header,$data,$user);
        return $this->return_data($return['code'],$return['msg'],$return['data']);
    }
    /**
     * 注册
     */
    function register($header,$data,$user){
        $res = new Login();
        $return=$res->register($header,$data,$user);
        return $this->return_data($return['code'],$return['msg'],$return['data']);
    }
    /**
     * 密码登录
     */
    function login_pwd($header,$data,$user){
        $res = new Login();
        $return=$res->login_pwd($header,$data,$user);
        return $this->return_data($return['code'],$return['msg'],$return['data']);
    }
    /**
     * 短信登录
     */
    function login_verifi($header,$data,$user){
        $res = new Login();
        $return=$res->login_verifi($header,$data,$user);
        return $this->return_data($return['code'],$return['msg'],$return['data']);
    }
    /**
     * 微信登录
     */
    function login_wx($header,$data,$user){
        $res = new Login();
        $return=$res->login_wx($header,$data,$user);
        return $this->return_data($return['code'],$return['msg'],$return['data']);
    }
    /**
     * 微信认证
     */
    function register_wx($header,$data,$user){
        $res = new Login();
        $return=$res->register_wx($header,$data,$user);
        return $this->return_data($return['code'],$return['msg'],$return['data']);
    }
    /**
     * 修改密码
     */
    function repassword($header,$data,$user){
        $res = new Login();
        $return=$res->repassword($header,$data,$user);
        return $this->return_data($return['code'],$return['msg'],$return['data']);
    }
    /**
     * 用户详情
     */
    function user_info($header,$data,$user){
        $res = new User();
        $return=$res->user_info($header,$data,$user);
        return $this->return_data($return['code'],$return['msg'],$return['data']);
    }
    /**
     * 用户剩余积分
     */
    function user_integral($header,$data,$user){
        $res = new User();
        $return=$res->user_integral($header,$data,$user);
        return $this->return_data($return['code'],$return['msg'],$return['data']);
    }
    /**
     * 首页banner
     */
    function banner($header,$data,$user){
        $res = new Other();
        $return=$res->banner($header,$data,$user);
        return $this->return_data($return['code'],$return['msg'],$return['data']);
    }
    /**
     * 首页分类
     */
    function index_type($header,$data,$user){
        $res = new Other();
        $return=$res->index_type($header,$data,$user);
        return $this->return_data($return['code'],$return['msg'],$return['data']);
    }
    /**
     * 服务地区
     */
    function work_address($header,$data,$user){
        $res = new Other();
        $return=$res->work_address($header,$data,$user);
        return $this->return_data($return['code'],$return['msg'],$return['data']);
    }
    /**
     * 自提地址
     */
    function system_address($header,$data,$user){
        $res = new Other();
        $return=$res->system_address($header,$data,$user);
        return $this->return_data($return['code'],$return['msg'],$return['data']);
    }
    /**
     * 我的收货地址
     */
    function my_address($header,$data,$user){
        $res = new User();
        $return=$res->my_address($header,$data,$user);
        return $this->return_data($return['code'],$return['msg'],$return['data']);
    }
    /**
     * 我的搜索词
     */
    function my_search($header,$data,$user){
        $res = new User();
        $return=$res->my_search($header,$data,$user);
        return $this->return_data($return['code'],$return['msg'],$return['data']);
    }
    /**
     * 删除搜索词
     */
    function del_search($header,$data,$user){
        $res = new User();
        $return=$res->del_search($header,$data,$user);
        return $this->return_data($return['code'],$return['msg'],$return['data']);
    }
    /**
     * 搜索
     */
    function search($header,$data,$user){
        $res = new Goods();
        $return=$res->search($header,$data,$user);
        return $this->return_data($return['code'],$return['msg'],$return['data']);
    }
    /**
     * 热门搜索
     */
    function hot_search($header,$data,$user){
        $res = new Other();
        $return=$res->hot_search($header,$data,$user);
        return $this->return_data($return['code'],$return['msg'],$return['data']);
    }
    /**
     * 首页推荐产品
     */
    function recommend($header,$data,$user){
        $res = new Goods();
        $return=$res->recommend($header,$data,$user);
        return $this->return_data($return['code'],$return['msg'],$return['data']);
    }
    /**
     * 购物车操作
     */
    function car_operation($header,$data,$user){
        $res = new Goods();
        $return=$res->car_operation($header,$data,$user);
        return $this->return_data($return['code'],$return['msg'],$return['data']);
    }
    /**
     * 删除购物车商品
     */
    function del_car_goods($header,$data,$user){
        $res = new Goods();
        $return=$res->del_car_goods($header,$data,$user);
        return $this->return_data($return['code'],$return['msg'],$return['data']);
    }
    /**
     * 清空购物车
     */
    function del_car($header,$data,$user){
        $res = new Goods();
        $return=$res->del_car($header,$data,$user);
        return $this->return_data($return['code'],$return['msg'],$return['data']);
    }
    /**
     * 收藏
     */
    function collect($header,$data,$user){
        $res = new Goods();
        $return=$res->collect($header,$data,$user);
        return $this->return_data($return['code'],$return['msg'],$return['data']);
    }
    /**
     * 取消收藏
     */
    function del_collect($header,$data,$user){
        $res = new Goods();
        $return=$res->del_collect($header,$data,$user);
        return $this->return_data($return['code'],$return['msg'],$return['data']);
    }
    /**
     * 收藏商品分类
     */
    function collect_type($header,$data,$user){
        $res = new Goods();
        $return=$res->collect_type($header,$data,$user);
        return $this->return_data($return['code'],$return['msg'],$return['data']);
    }
    /**
     * 我的收藏商品
     */
    function my_collect($header,$data,$user){
        $res = new Goods();
        $return=$res->my_collect($header,$data,$user);
        return $this->return_data($return['code'],$return['msg'],$return['data']);
    }
    /**
     * 常购商品分类
     */
    function daily_type($header,$data,$user){
        $res = new Goods();
        $return=$res->daily_type($header,$data,$user);
        return $this->return_data($return['code'],$return['msg'],$return['data']);
    }
    /**
     * 常购商品
     */
    function daily_goods($header,$data,$user){
        $res = new Goods();
        $return=$res->daily_goods($header,$data,$user);
        return $this->return_data($return['code'],$return['msg'],$return['data']);
    }
    /**
     * 分类列表
     */
    function type_list($header,$data,$user){
        $res = new Goods();
        $return=$res->type_list($header,$data,$user);
        return $this->return_data($return['code'],$return['msg'],$return['data']);
    }
    /**
     * 全部分类
     */
    function all_type($header,$data,$user){
        $res = new Goods();
        $return=$res->all_type($header,$data,$user);
        return $this->return_data($return['code'],$return['msg'],$return['data']);
    }
    /**
     * 添加收货地址
     */
    function add_address($header,$data,$user){
        $res = new User();
        $return=$res->add_address($header,$data,$user);
        return $this->return_data($return['code'],$return['msg'],$return['data']);
    }
    /**
     * 修改收货地址
     */
    function readdress($header,$data,$user){
        $res = new User();
        $return=$res->readdress($header,$data,$user);
        return $this->return_data($return['code'],$return['msg'],$return['data']);
    }
    /**
     * 默认收货地址
     */
    function default_address($header,$data,$user){
        $res = new User();
        $return=$res->default_address($header,$data,$user);
        return $this->return_data($return['code'],$return['msg'],$return['data']);
    }
    /**
     * 删除收货地址
     */
    function del_address($header,$data,$user){
        $res = new User();
        $return=$res->del_address($header,$data,$user);
        return $this->return_data($return['code'],$return['msg'],$return['data']);
    }
    /**
     * 我的购物车
     */
    function my_car($header,$data,$user){
        $res = new User();
        $return=$res->my_car($header,$data,$user);
        return $this->return_data($return['code'],$return['msg'],$return['data']);
    }
    /**
     * 优惠券（可积分兑换）列表
     */
    function coupon($header,$data,$user){
        $res = new Other();
        $return=$res->coupon($header,$data,$user);
        return $this->return_data($return['code'],$return['msg'],$return['data']);
    }
    /**
     * 兑换优惠券
     */
    function exchange_coupon($header,$data,$user){
        $res = new User();
        $return=$res->exchange_coupon($header,$data,$user);
        return $this->return_data($return['code'],$return['msg'],$return['data']);
    }
    /**
     * 兑换优惠券
     */
    function my_coupon($header,$data,$user){
        $res = new User();
        $return=$res->my_coupon($header,$data,$user);
        return $this->return_data($return['code'],$return['msg'],$return['data']);
    }
    /**
     * 限时抢购计划列表
     */
    function rush_list($header,$data,$user){
        $res = new Goods();
        $return=$res->rush_list($header,$data,$user);
        return $this->return_data($return['code'],$return['msg'],$return['data']);
    }
    /**
     * 限时抢购计划商品
     */
    function rush_goods($header,$data,$user){
        $res = new Goods();
        $return=$res->rush_goods($header,$data,$user);
        return $this->return_data($return['code'],$return['msg'],$return['data']);
    }
    /**
     * 特价商品
     */
    function special_goods($header,$data,$user){
        $res = new Goods();
        $return=$res->special_goods($header,$data,$user);
        return $this->return_data($return['code'],$return['msg'],$return['data']);
    }
    /**
     * 商品标签列表
     */
    function goods_label($header,$data,$user){
        $res = new Goods();
        $return=$res->goods_label($header,$data,$user);
        return $this->return_data($return['code'],$return['msg'],$return['data']);
    }
    /**
     * 分类商品
     */
    function type_goods($header,$data,$user){
        $res = new Goods();
        $return=$res->type_goods($header,$data,$user);
        return $this->return_data($return['code'],$return['msg'],$return['data']);
    }
    /**
     * 上传图片的信息
     */
    function upload_information($header,$data,$user){
        $res = new User();
        $return=$res->upload_information($header,$data,$user);
        return $this->return_data($return['code'],$return['msg'],$return['data']);
    }
    /**
     * 上传图片
     */
    function upload($header,$data,$user){
        $res = new Upload();
        $return=$res->upload($header,$data,$user);
        return $this->return_data($return['code'],$return['msg'],$return['data']);
    }

    /**
     * 修改头像
     */
    function head_img($header, $data, $user)
    {
        $res = new User();
        $return = $res->head_img($header, $data, $user);
        return $this->return_data($return['code'], $return['msg'], $return['data']);
    }
    /**
     * 积分记录
     */
    function integral_log($header, $data, $user)
    {
        $res = new User();
        $return = $res->integral_log($header, $data, $user);
        return $this->return_data($return['code'], $return['msg'], $return['data']);
    }
    /**
     * 购物车数量
     */
    function car_number($header, $data, $user)
    {
        $res = new User();
        $return = $res->car_number($header, $data, $user);
        return $this->return_data($return['code'], $return['msg'], $return['data']);
    }
    /**
     * 商品详情
     */
    function goods_details($header, $data, $user)
    {
        $res = new Goods();
        $return = $res->goods_details($header, $data, $user);
        return $this->return_data($return['code'], $return['msg'], $return['data']);
    }
    /**
     * 提货、收货时间
     */
    function useful_time($header, $data, $user)
    {
        $res = new Other();
        $return = $res->useful_time($header, $data, $user);
        return $this->return_data($return['code'], $return['msg'], $return['data']);
    }
    /**
     * 提货、收货时间
     */
    function useful_coupon($header, $data, $user)
    {
        $res = new User();
        $return = $res->useful_coupon($header, $data, $user);
        return $this->return_data($return['code'], $return['msg'], $return['data']);
    }
    /**
     * 提交需求
     */
    function demand($header, $data, $user)
    {
        $res = new User();
        $return = $res->demand($header, $data, $user);
        return $this->return_data($return['code'], $return['msg'], $return['data']);
    }
    /**
     * 需求列表
     */
    function demand_list($header, $data, $user)
    {
        $res = new User();
        $return = $res->demand_list($header, $data, $user);
        return $this->return_data($return['code'], $return['msg'], $return['data']);
    }
    /**
     * 需求详情
     */
    function demand_details($header, $data, $user)
    {
        $res = new User();
        $return = $res->demand_details($header, $data, $user);
        return $this->return_data($return['code'], $return['msg'], $return['data']);
    }
    /**
     * 常见问题列表
     */
    function problem_list($header, $data, $user)
    {
        $res = new Other();
        $return = $res->problem_list($header, $data, $user);
        return $this->return_data($return['code'], $return['msg'], $return['data']);
    }
    /**
     * 常见问题详情
     */
    function problem_details($header, $data, $user)
    {
        $res = new Other();
        $return = $res->problem_details($header, $data, $user);
        return $this->return_data($return['code'], $return['msg'], $return['data']);
    }
    /**
     * 协议、文章详情
     */
    function article_details($header, $data, $user)
    {
        $res = new Article();
        $return = $res->article_details($header, $data, $user);
        return $this->return_data($return['code'], $return['msg'], $return['data']);
    }
    /**
     * 商铺类型
     */
    function store_type($header, $data, $user)
    {
        $res = new User();
        $return = $res->store_type($header, $data, $user);
        return $this->return_data($return['code'], $return['msg'], $return['data']);
    }
    /**
     * 申请是否认证
     */
    function identity($header, $data, $user)
    {
        $res = new User();
        $return = $res->identity($header, $data, $user);
        return $this->return_data($return['code'], $return['msg'], $return['data']);
    }
    /**
     * 下单
     */
    function order($header, $data, $user)
    {
        $res = new Order();
        $return = $res->order($header, $data, $user);
        return $this->return_data($return['code'], $return['msg'], $return['data']);
    }
    /**
     * 下单
     */
    function order_time($header, $data, $user)
    {
        $res = new Order();
        $return = $res->order_time($header, $data, $user);
        return $this->return_data($return['code'], $return['msg'], $return['data']);
    }
    /**
     * 订单支付
     */
    function order_pay($header, $data, $user)
    {
        $res = new Order();
        $return = $res->order_pay($header, $data, $user);
        return $this->return_data($return['code'], $return['msg'], $return['data']);
    }
    /**
     * 订单数量
     */
    function order_count($header, $data, $user)
    {
        $res = new Order();
        $return = $res->order_count($header, $data, $user);
        return $this->return_data($return['code'], $return['msg'], $return['data']);
    }
    /**
     * 订单列表
     */
    function order_list($header, $data, $user)
    {
        $res = new Order();
        $return = $res->order_list($header, $data, $user);
        return $this->return_data($return['code'], $return['msg'], $return['data']);
    }
    /**
     * 订单详情
     */
    function order_details($header, $data, $user)
    {
        $res = new Order();
        $return = $res->order_details($header, $data, $user);
        return $this->return_data($return['code'], $return['msg'], $return['data']);
    }
    /**
     * 继续支付
     */
    function order_continue_pay($header, $data, $user)
    {
        $res = new Order();
        $return = $res->order_continue_pay($header, $data, $user);
        return $this->return_data($return['code'], $return['msg'], $return['data']);
    }
    /**
     * 取消订单
     */
    function order_cancel($header, $data, $user)
    {
        $res = new Order();
        $return = $res->order_cancel($header, $data, $user);
        return $this->return_data($return['code'], $return['msg'], $return['data']);
    }
    /**
     * 收货
     */
    function order_collect($header, $data, $user)
    {
        $res = new Order();
        $return = $res->order_collect($header, $data, $user);
        return $this->return_data($return['code'], $return['msg'], $return['data']);
    }
    /**
     * 申请退货
     */
    function order_return($header, $data, $user)
    {
        $res = new Order();
        $return = $res->order_return($header, $data, $user);
        return $this->return_data($return['code'], $return['msg'], $return['data']);
    }
    /**
     * 订单状态
     */
    function order_status($header, $data, $user)
    {
        $res = new Order();
        $return = $res->order_status($header, $data, $user);
        return $this->return_data($return['code'], $return['msg'], $return['data']);
    }
    /**
     * 未读消息数量
     */
    function message_count($header, $data, $user)
    {
        $res = new Message();
        $return = $res->message_count($header, $data, $user);
        return $this->return_data($return['code'], $return['msg'], $return['data']);
    }
    /**
     * 消息列表
     */
    function message_list($header, $data, $user)
    {
        $res = new Message();
        $return = $res->message_list($header, $data, $user);
        return $this->return_data($return['code'], $return['msg'], $return['data']);
    }
    /**
     * 消息详情
     */
    function message_details($header, $data, $user)
    {
        $res = new Message();
        $return = $res->message_details($header, $data, $user);
        return $this->return_data($return['code'], $return['msg'], $return['data']);
    }
    /**
     * 标为已读
     */
    function message_read($header, $data, $user)
    {
        $res = new Message();
        $return = $res->message_read($header, $data, $user);
        return $this->return_data($return['code'], $return['msg'], $return['data']);
    }
}